package com.zonhar.autofeed.aplay;

import java.io.*;

import javazoom.jl.decoder.Decoder;
import javazoom.jl.player.Player;
import org.springframework.core.io.ClassPathResource;

/**
 * Java 播放音频
 * @author zonhar
 */
public class MusicPlayer {

	public static void feedPlay(){
		play("mp3/over.mp3");
	}

	public static void overPlay(){
		play("mp3/tfml.mp3");
	}

	private static void play(String path){
		try {
			ClassPathResource classPathResource = new ClassPathResource(path);
			InputStream inputStream =classPathResource.getInputStream();
			BufferedInputStream stream = new BufferedInputStream(inputStream);
			Player player = new Player(stream);
			player.play();
		}catch (Exception e){
			e.printStackTrace();
		}
	}


}
